
class Dog: # 定义一个狗类

    def __init__(self,name,age,breed,master):
        self.name = name # 每一只狗都有自己的名字；
        self.age  = age
        self.breed = breed # 每一只狗都有自己的品种；
        self.master = master # master传进来的应该是个对象
        self.sayhi()

    def sayhi(self):
        print("Hi I'm %s, a %s dog,my master is %s"%(self.name,self.breed,self.master.name))


class Person: # 定义一个人类

    def __init__(self,name,age,sex):
        self.name = name
        self.age = age
        self.sex  = sex

    def walk_dog(self,dog_obj):
        """遛狗"""
        print("主人[%s]带狗[%s]去溜溜..."%(self.name,dog_obj.name))


p1 = Person("Alex",25,"M")

d1 = Dog("Mjj",2,"二哈",p1)
